#include"string.h"
namespace bit
{
	void test1_string()
	{
		string s;
		cout << s.c_str()<<endl;
		string s2("hello world");
		cout << s2.c_str() << endl;
		s2[0] = 'X';
		cout << s2.c_str() << endl;
		const string s3 = "adsd";
		for (auto ch : s2)
		{
			cout << ch <<" ";
		}
		for (auto ch : s3)
		{
			cout << ch << " ";
		}
	}
	void test2_string()
	{
		string s;
		s.push_back('H');
		s.push_back('H');
		s.push_back('H');
		cout << s.c_str() << endl;
		s.append("Totalhaha");
		cout << s.c_str() << endl;
		s += "123";
		cout << s.c_str() << endl;
		s.insert(0, 'X');
		cout << s.c_str() << endl;
		s.insert(0, "Linux:");
		cout << s.c_str() << endl;
		s.erase(1, 4);
		cout << s.c_str() << endl;
		


	}
	void test3_string()
	{
		string s1 = "Total";
		string s2 = s1;
		s1[0] = 'a';
		string s3;
		s3 = s1;
		cout << s1.c_str() << endl<<s2.c_str()<<endl<<s3.c_str()<<endl;
		cout << s1 <<s2<< endl;
		string s4;
		s4.resize(10, '*');
		cout << s4 << endl;
		string s5 = s1.substr(2,11);
		cout << s5 << endl;
	}
	void test4_string()
	{
		/*string s1, s2("12234");
		cin >> s1 >> s2;
		cout << s1 << endl << s2<<endl;
		getline(cin, s1);
		cout << s1 << endl;*/
		string s1 = "123";
		string s2 = "456";
		swap(s1, s2);
		cout << s1 << endl << s2 << endl;
	}
	
}

int main()
{
	//bit::test1_string();
	//bit::test2_string();
	bit::test3_string();
	//bit::test4_string();
	
	return 0;
}